package com.sishu.controller;

import com.sishu.pojo.TeamStudent;
import com.sishu.pojo.dto.Studentdto;
import com.sishu.service.GameGroupService;
import com.sishu.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@SuppressWarnings("rawtypes")
@RestController
@Slf4j
@RequestMapping("/group/")
@CrossOrigin(origins = "*")
public class GameGroupController {

    @Resource
    private GameGroupService gameGroupService;


    @PostMapping("addgroup")
    public Result addGroup(@RequestBody List<Studentdto> students) {
        log.info("students = " + students);
        return gameGroupService.addGroup(students);

    }


    @PostMapping("addteamgroup")
    public Result addTeamGroup(@RequestBody List<TeamStudent> students) {
        log.info("students = " + students);
        return gameGroupService.addTeamGroup(students);

    }


    @GetMapping("groupasset") //查询该组的资产情况
    public Result selectgroupasset(@Param("groupId") String groupId) {
        return gameGroupService.selcetgroupasset(groupId);
    }

}
